import http from "@/api";

/**
 * @name 用户管理模块
 */
// 获取用户列表
export const getUserList = (params = {}) => {
  return http.post(`/operator/query`, params, { noLoading: true });
};

// 新增用户
export const addUser = (params = {}) => {
  return http.post(`/operator/save`, params, { noLoading: true });
};
// 编辑用户
export const editUser = (params = {}) => {
  return http.post(`/operator/save`, params, { noLoading: true });
};

// 删除用户
export const delUser = (params = {}) => {
  return http.post(`/operator/delete`, params);
};

// 重置用户密码
export const resetPsd = (params = {}) => {
  return http.post(`/operator/resetPWD`, params);
};

// 获取用户角色权限
export const getRoleTree = (params = {}) => {
  return http.get(`/rights/tree`, params, { noLoading: true });
};

/**
 * 获取用户部门权限
 * @param params
 */
export const getDptRights = (params = {}) => {
  return http.get(`/department/rights`, params);
};

/**
 * 获取用户地图权限
 * @param params
 */
export const getMapRights = (params = {}) => {
  return http.get(`/map/rights`, params);
};

/**
 * 获取用户门禁组权限
 * @param params
 */
export const getRuleGroupRights = (params = {}) => {
  return http.get(`/rule-group/rights`, params);
};

/**
 * 获取用户门锁地图权限
 * @param params
 */
export const getRoomMapRights = (params = {}) => {
  return http.get(`/room-map/rights`, params);
};

/**
 * 获取用户门禁点
 * @param params
 */
export const getDoorRightsList = (params = {}) => {
  return http.post(`/door/rights/query`, params);
};

/**
 * 更新用户角色
 * @param params
 */
export const saveOperatorRoles = (params = {}) => {
  return http.post(`/operator/roles/save`, params);
};

/**
 * 更新用户部门权限
 * @param params
 */
export const saveDepartmentRights = (params = {}) => {
  return http.post(`/department/rights/save`, params, { noLoading: true });
};

/**
 * 更新用户地图权限
 * @param params
 */
export const saveMapRights = (params = {}) => {
  return http.post(`/map/rights/save`, params, { noLoading: true });
};

/**
 * 更新用户门禁组权限
 * @param params
 */
export const saveRuleGroupRights = (params = {}) => {
  return http.post(`/rule-group/rights/save`, params, { noLoading: true });
};

/**
 * 更新用户锁地图权限
 * @param params
 */
export const saveRoomMapRights = (params = {}) => {
  return http.post(`/room-map/rights/save`, params, { noLoading: true });
};

/**
 * 更新用户的门禁点权限
 * @param params
 */
export const saveDoorRights = (params = {}) => {
  return http.post(`/door/rights/save`, params);
};

/**
 * 删除门禁点权限
 * @param params
 */
export const delDoorRights = (params = {}) => {
  return http.post(`/door/rights/delete`, params);
};

/**
 * 获取门禁点区域
 * @param params
 */
export const getDoorAreaList = (params = {}) => {
  return http.get(`/lookup/areas`, params);
};
